/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package za.ac.cput.ImplMenu;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import za.ac.cput.AbsMenu.AbstractMenu;
import java.util.concurrent.*;
import za.ac.cput.Threadies.Threadies.Impl.ThreadPie;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
 *
 * @author User 1
 */
public class Menu extends AbstractMenu {
    JButton prog1 = new JButton();
    JButton prog2 = new JButton();
    ThreadPie runThis = new ThreadPie();
   public Menu(){
        this.setLayout(new FlowLayout());
        this.add(prog1);
        this.add(prog2);
        prog1.setText("Run Pie");
        prog2.setText("Exit");
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        prog1.addActionListener(this);
        prog2.addActionListener(this);
   }

    @Override
    public void actionPerformed(ActionEvent e) {
        if(e.getSource() == prog1)
        {
            runThis.run();
        }
        else if(e.getSource() == prog2)
        {
           
            try{
                System.out.println("I love threads\n Goodbye");
                this.dispose();
            }
            catch(Exception ex){
               
            }
            
        }
        
        
    }
    public long getA(){    
        return (long) runThis.getA();
    }
    public long getB(){    
        return runThis.getB();
    }
}
